#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
/*int cmp_int(const void* p1, const void* p2)
{
	return *(int*)p1 - *(int*)p2;
}
int main()
{
	int arr[] = {9,8,7,6,5,4,3,2,1,0};
	int sz = sizeof(arr) / sizeof(arr[0]);
	qsort(arr,sz,sizeof(arr[0]),cmp_int);
	for (int i = 0; i < sz; i++)
	{
		printf("%d ", arr[i]);
	}
	return 0;
}*/
struct Stu
{
	char name[20];
	int age;
};
int cmp_name(const void* p1, const void* p2)
{
	return strcmp((*(struct Stu*)p1).name ,(*(struct Stu*)p2).name);
}
int cmp_age(const void* p1, const void* p2)
{
	return (*(struct Stu*)p1).age - (*(struct Stu*)p2).age;
}
int main()
{
	struct Stu arr[] = { {"zhangshan",20},{"lishi",18},{"wangwu",19}};
	int sz = sizeof(arr) / sizeof(arr[0]);
	qsort(arr,sz,sizeof(arr[0]),cmp_age);
	return 0;
}